From: Carlos Garnacho Date: Wed, 9 Mar 2022 22:32:30 +0000 (+0100) Subject: keyboard: Prevent OSK key buttons from creating grabs X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~507^2^2~6 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=c1d13fb4714b2813c84be3cfdaea4c898de93484;p=gnome-shell.git keyboard: Prevent OSK key buttons from creating grabs In a very un-StButton fashion, OSK keys are not interested in altering the current focus state, as otherwise pressing those will trigger a grab that will alter key focus, so the generated key or IM state events will not be handled by the actor that originally had the focus as long as the OSK key is pressed. Despite being StButtons, OSK keys do already perform their own press/release handling with internal state tracking, so it is not a big stretch to simply consume the events, and update the :active pseudo-class manually. This makes OSK keys still look and behave as usual, but without any grabbing shenanigans that might affect the focus state. This makes all OSK keys work again. Fixes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4986 Part-of: --- diff --git a/js/ui/keyboard.js b/js/ui/keyboard.js index af195dccf..37c71b16b 100644 --- a/js/ui/keyboard.js +++ b/js/ui/keyboard.js @@ -449,11 +449,13 @@ var Key = GObject.registerClass({ button.keyWidth = 1; button.connect('button-press-event', () => { this._press(key); - return Clutter.EVENT_PROPAGATE; + button.add_style_pseudo_class('active'); + return Clutter.EVENT_STOP; }); button.connect('button-release-event', () => { this._release(key); - return Clutter.EVENT_PROPAGATE; + button.remove_style_pseudo_class('active'); + return Clutter.EVENT_STOP; }); button.connect('touch-event', (actor, event) => { // We only handle touch events here on wayland. On X11 @@ -472,15 +474,18 @@ var Key = GObject.registerClass({ event.type() == Clutter.EventType.TOUCH_BEGIN) { this._touchPressSlot = slot; this._press(key); + button.add_style_pseudo_class('active'); } else if (event.type() === Clutter.EventType.TOUCH_END) { if (!this._touchPressSlot || - this._touchPressSlot === slot) + this._touchPressSlot === slot) { this._release(key); + button.remove_style_pseudo_class('active'); + } if (this._touchPressSlot === slot) this._touchPressSlot = null; } - return Clutter.EVENT_PROPAGATE; + return Clutter.EVENT_STOP; }); return button;